#include <stdio.h>
#include <stdlib.h>

typedef int ElemType;
// 定义链式栈
typedef struct StackNode {
    ElemType data; //数据域
    struct StackNode* next; //指针域
}StackNode,*StackList;

//入栈：往链表的头部插入元素(链表带头结点)
bool putStack(StackList& s, ElemType e) {
    if (s == NULL) return false;
    StackNode* p = (StackNode*)malloc(sizeof(StackNode)); //分配内存空间
    if (p == NULL) return false; //内存分配失败
    p->data = e; //结点p保存元素的e
    p->next = s->next;
    s->next = p;
    return true;
}
//出栈：删除链表的第一个元素(链表带头结点)，并保存到e
bool popStack(StackList& s, ElemType& e) {
    if (s == NULL) return false;
    StackNode* p = s->next; //指向被删除的结点
    if (p == NULL) return false;
    e = p->data; //将被删除的结点的元素赋值给e
    s->next = p->next;
    free(p); //释放结点的存储空间
    return true;
}

int main() {
    return 0;
}